package net.sky.oa.model;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

/**
 * 分组与通讯录关系表
 * AddAddrgroup. @author hond
 */
@Entity
@Table(name = "ADD_ADDRGROUP")//分组与通讯录关系表
public class AddAddrgroup implements Serializable {

	private static final long serialVersionUID = 5673991033245515351L;
	
	// Fields
	private Long id;
	private Integer sort;       //类别：内、外联系人
	private AddGroup group;  //分组id
	private SysEmployee user;//员工id
	private AddMyaddr myaddr;//个人电话表id

	// Constructors

	/** default constructor */
	public AddAddrgroup() {
	}
	
	@Id 
	@SequenceGenerator(name="SQ_ADDADDRGROUP_ID",sequenceName="SQ_ADDADDRGROUP_ID",allocationSize=1)
	@GeneratedValue(strategy=GenerationType.SEQUENCE,generator="SQ_ADDADDRGROUP_ID")
	@Column(name = "ID", unique = true, nullable = false)
	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	@Column(name = "SORT", precision = 2, scale = 0)
	public Integer getSort() {
		return sort;
	}

	public void setSort(Integer sort) {
		this.sort = sort;
	}

	@ManyToOne(fetch = FetchType.EAGER)
	@JoinColumn(name = "GROUP_ID")
	public AddGroup getGroup() {
		return this.group;
	}

	public void setGroup(AddGroup group) {
		this.group = group;
	}

	@ManyToOne(fetch = FetchType.EAGER)
	@JoinColumn(name = "USER_ID")
	public SysEmployee getUser() {
		return this.user;
	}

	public void setUser(SysEmployee user) {
		this.user = user;
	}

	@ManyToOne(fetch = FetchType.EAGER)
	@JoinColumn(name = "MYADDR_ID")
	public AddMyaddr getMyaddr() {
		return this.myaddr;
	}

	public void setMyaddr(AddMyaddr myaddr) {
		this.myaddr = myaddr;
	}

}